<?php

/* 

 * To change this license header, choose License Headers in Project Properties.

 * To change this template file, choose Tools | Templates

 * and open the template in the editor.

 */
 require_once 'db_conn.php';
//删除功能第一要点，如何获得当前要删除的留言ID index.php-->bbsDel.php
$id= isset($_GET["id"])?$_GET["id"] :0;
$sql="delete from t_message where id='$id'";

 $result=$db->query($sql);  //看执行
 
 //判断删除留言是否成功
if($result)
 {
     echo "<script language='javascript' type='text/javascript'>";
     echo"alert('删除成功!');";
     echo "window.location.href='index.php'";
     echo"</script>";
 }
else
{
    echo "<script language='javascript' type='text/javascript'>";
    echo "alert('删除失败!');";
     echo "window.location.href='index.php'";
     echo"</script>";
}

 //header("Location:index.php");